def parse_bing_image_custom_search_api(api_response, headers, thumbnail_only):
    next_offset = api_response['nextOffset']
    total_estimated_matches = api_response['totalEstimatedMatches']
    has_next = next_offset < total_estimated_matches
    results = []
    for image_context in api_response['value']:
        image_id = image_context['imageId']
        host_page_url = image_context['hostPageUrl']
        content_url = image_context['contentUrl']
        thumbnail_url = image_context['thumbnailUrl']

        name = image_context['name']

        image_url_candidates_with_header = []
        if not thumbnail_only:
            if 'cDNContentUrl' in image_context:
                image_url_candidates_with_header.append((image_context['cDNContentUrl'], headers['BING_IMAGE_HEADER']))
            image_url_candidates_with_header.append((content_url, headers['IMAGE_HEADER']))
        image_url_candidates_with_header.append((thumbnail_url, headers['BING_IMAGE_HEADER']))
        results.append((image_url_candidates_with_header, thumbnail_url, image_id, host_page_url, content_url, name))
    return has_next, next_offset, results
